<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-

transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
  <title><s:text name="config.list.title"/></title>
  <%@ include file="/common/meta.jsp"%>
  <%@ include file="/common/common.jsp"%>
</head>
<body>
<form name="tableList" method="POST" action="config-update.action" onsubmit="return chkform()">
<div id="wrapper">
  <div class="curmb"><s:text name="your.site.position"/>:<a href="${ctx}/main.action"><s:text name="homepage"/></a><span>></span><s:text name="config.title"/></div>
  <div class="listtit" id="listtit"><p><span><strong><s:text name="config.list.title"/></strong></span></p></div>
  <div class="listoperate" id="listoperate">
    <span class="space20"></span>
     <a href="#" class="alinkscurrent"><s:text name="userConfig" />
     </a>|<a href="#" class="alinks"><s:text name="emailConfig" /> 
     </a>|<a href="#" class="alinks"><s:text name="commentConfig" />
     </a>|<a href="#" class="alinks"><s:text name="attachConfig" /></a>
  </div>
  <div class="listbox" id="listbox">
    <table class="listgrid" >
      <tbody>
        <tr>
          <th class="w31p"><s:text name="config.memo"/></th>
          <th class="w31p"><s:text name="config.configAttrValue"/></th>
          <th class="w31p"><s:text name="config.configAttrKey"/></th>
        </tr>
        <s:iterator value="userConfigList" status="u">
        <tr>
        <td class="disnone">
        <s:hidden name="userConfigList[%{#u.index}].configId" value="%{configId}" />
        <s:hidden name="userConfigList[%{#u.index}].configType" value="%{configType}" />
        <s:hidden name="userConfigList[%{#u.index}].configAttrKey" value="%{configAttrKey}" />
        <s:hidden name="userConfigList[%{#u.index}].memo" value="%{memo}" />
        </td>
            <td class="alignr"><s:property value="memo" /> &nbsp;</td>
            <td>
              <s:if test="configAttrKey=='attachment_delete_Flag' ||configAttrKey=='comment_Dirty_Words_flag' ||configAttrKey=='comment_Security_Flag'||configAttrKey=='comment_Need_Audit'||configAttrKey=='comment_Status'
                  ||configAttrKey=='security_Code_Flag'">
                 <s:radio list="isActiveList" name="userConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" listKey="dictionaryKey" listValue="dictionaryValue"></s:radio>
              </s:if>
              <s:elseif test="configAttrKey=='security_Code_Run_Num' ||configAttrKey=='email_Port'
                      ||configAttrKey=='comment_Interval_Time' ||configAttrKey=='comment_Max_Num_Perhour'
                      ||configAttrKey=='comment_Max_Security_Perhour' ||configAttrKey=='attachment_Advice_Size'">
                	<s:textfield name="userConfigList[%{#u.index}].configAttrValue" onblur="isNum(this,'%{configAttrKey}');" maxlength="18" value="%{configAttrValue}" cssClass="txtin"/>
                <span id="<s:property value='configAttrKey'/>" style="color: red;"></span>
              </s:elseif>
              <s:elseif test="configAttrKey=='init_Admin_Password'">
              	<s:textfield name="userConfigList[%{#u.index}].configAttrValue" onblur="isPasswd(this,'%{configAttrKey}');" maxlength="18" value="%{configAttrValue}" cssClass="txtin"/>
              	<span id="<s:property value='configAttrKey'/>" style="color: red;"></span>
              </s:elseif>
              <s:else>
              <s:textfield name="userConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" maxlength="23" cssClass="txtin"/>
              </s:else>
            </td>
          <td class="alignl"><s:property value="configAttrKey"/>&nbsp;</td>
        </tr>
        </s:iterator>
        <tr>
          <td class="height100" colspan="3"><s:submit cssClass="btnlist2" value="%{getText('save')}"/><s:reset value="%{getText('reset')}" cssClass="btnlist2"/></td>
        </tr>
      </tbody>
    </table>
    <table class="listgrid disnone">
      <tbody>
        <tr>
          <th class="w31p"><s:text name="config.memo"/></th>
          <th class="w31p"><s:text name="config.configAttrValue"/></th>
          <th class="w31p"><s:text name="config.configAttrKey"/></th>
        </tr>
        <s:iterator value="emailConfigList" status="u">
        <tr>
        <td class="disnone">
        <s:hidden name="emailConfigList[%{#u.index}].configId" value="%{configId}" />
        <s:hidden name="emailConfigList[%{#u.index}].configType" value="%{configType}" />
        <s:hidden name="emailConfigList[%{#u.index}].configAttrKey" value="%{configAttrKey}" />
        <s:hidden name="emailConfigList[%{#u.index}].memo" value="%{memo}" />
        </td>
            <td class="alignr"><s:property value="memo" />&nbsp;</td>
            <td>
              <s:if test="configAttrKey=='attachment_delete_Flag' ||configAttrKey=='comment_Dirty_Words_flag' ||configAttrKey=='comment_Security_Flag'||configAttrKey=='comment_Need_Audit'||configAttrKey=='comment_Status'
                  ||configAttrKey=='security_Code_Flag'">
                 <s:radio list="isActiveList" name="emailConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" listKey="dictionaryKey" listValue="dictionaryValue"></s:radio>
              </s:if>
              <s:elseif test="configAttrKey=='security_Code_Run_Num' ||configAttrKey=='email_Port'
                      ||configAttrKey=='comment_Interval_Time' ||configAttrKey=='comment_Max_Num_Perhour'
                      ||configAttrKey=='comment_Max_Security_Perhour' ||configAttrKey=='attachment_Advice_Size'">
                	<s:textfield name="emailConfigList[%{#u.index}].configAttrValue" onblur="isNum(this,'%{configAttrKey}');" maxlength="18" value="%{configAttrValue}" cssClass="txtin"/>
                <span id="<s:property value='configAttrKey'/>" style="color: red;"></span>
              </s:elseif>
              <s:else>
              <s:textfield name="emailConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" maxlength="23" cssClass="txtin"/>
              </s:else>
            </td>
          <td class="alignl"><s:property value="configAttrKey"/>&nbsp;</td>
        </tr>
        </s:iterator>
        <tr>
        <td class="height100" colspan="3"><s:submit cssClass="btnlist2" value="%{getText('save')}"/><s:reset value="%{getText('reset')}" cssClass="btnlist2"/></td>
        </tr>
      </tbody>
    </table>
    <table class="listgrid disnone">
      <tbody>
        <tr>
          <th class="w31p"><s:text name="config.memo"/></th>
          <th class="w31p"><s:text name="config.configAttrValue"/></th>
          <th class="w31p"><s:text name="config.configAttrKey"/></th>
        </tr>
        <s:iterator value="commentConfigList" status="u">
        <tr>
        <td class="disnone">
        <s:hidden name="commentConfigList[%{#u.index}].configId" value="%{configId}" />
        <s:hidden name="commentConfigList[%{#u.index}].configType" value="%{configType}" />
        <s:hidden name="commentConfigList[%{#u.index}].configAttrKey" value="%{configAttrKey}" />
        <s:hidden name="commentConfigList[%{#u.index}].memo" value="%{memo}" />
        </td>
            <td class="alignr"><s:property value="memo" />&nbsp;</td>
            <td>
              <s:if test="configAttrKey=='attachment_delete_Flag' ||configAttrKey=='comment_Dirty_Words_flag' ||configAttrKey=='comment_Security_Flag'||configAttrKey=='comment_Need_Audit'||configAttrKey=='comment_Status'
                  ||configAttrKey=='security_Code_Flag'">
                 <s:radio list="isActiveList" name="commentConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" listKey="dictionaryKey" listValue="dictionaryValue"></s:radio>
              </s:if>
              <s:elseif test="configAttrKey=='security_Code_Run_Num' ||configAttrKey=='email_Port'
                      ||configAttrKey=='comment_Interval_Time' ||configAttrKey=='comment_Max_Num_Perhour'
                      ||configAttrKey=='comment_Max_Security_Perhour' ||configAttrKey=='attachment_Advice_Size'">
                	<s:textfield name="commentConfigList[%{#u.index}].configAttrValue" onblur="isNum(this,'%{configAttrKey}');" maxlength="18" value="%{configAttrValue}" cssClass="txtin"/>
                <span id="<s:property value='configAttrKey'/>" style="color: red;"></span>
              </s:elseif>
              <s:else>
              <s:textfield name="commentConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" maxlength="23" cssClass="txtin"/>
              </s:else>
            </td>
          <td class="alignl"><s:property value="configAttrKey"/>&nbsp;</td>
        </tr>
        </s:iterator>
        <tr>
        <td class="height100" colspan="3"><s:submit cssClass="btnlist2" value="%{getText('save')}"/><s:reset value="%{getText('reset')}" cssClass="btnlist2"/></td>
        </tr>
      </tbody>
    </table>
    <table class="listgrid disnone">
      <tbody>
        <tr>
          <th class="w31p"><s:text name="config.memo"/></th>
          <th class="w31p"><s:text name="config.configAttrValue"/></th>
          <th class="w31p"><s:text name="config.configAttrKey"/></th>
        </tr>
        <s:iterator value="attachConfigList" status="u">
        <tr>
        <td class="disnone">
        <s:hidden name="attachConfigList[%{#u.index}].configId" value="%{configId}" />
        <s:hidden name="attachConfigList[%{#u.index}].configType" value="%{configType}" />
        <s:hidden name="attachConfigList[%{#u.index}].configAttrKey" value="%{configAttrKey}" />
        <s:hidden name="attachConfigList[%{#u.index}].memo" value="%{memo}" />
        </td>
            <td class="alignr"><s:property value="memo" />&nbsp;</td>
            <td>
              <s:if test="configAttrKey=='attachment_delete_Flag' ||configAttrKey=='comment_Dirty_Words_flag' ||configAttrKey=='comment_Security_Flag'||configAttrKey=='comment_Need_Audit'||configAttrKey=='comment_Status'
                  ||configAttrKey=='security_Code_Flag'">
                 <s:radio list="isActiveList" name="attachConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" listKey="dictionaryKey" listValue="dictionaryValue"></s:radio>
              </s:if>
              <s:elseif test="configAttrKey=='security_Code_Run_Num' ||configAttrKey=='email_Port'
                      ||configAttrKey=='comment_Interval_Time' ||configAttrKey=='comment_Max_Num_Perhour'
                      ||configAttrKey=='comment_Max_Security_Perhour' ||configAttrKey=='attachment_Advice_Size'">
                	<s:textfield name="attachConfigList[%{#u.index}].configAttrValue" onblur="isNum(this,'%{configAttrKey}');" maxlength="18" value="%{configAttrValue}" cssClass="txtin"/>
                <span id="<s:property value='configAttrKey'/>" style="color: red;"></span>
              </s:elseif>
              <s:else>
              <s:textfield name="attachConfigList[%{#u.index}].configAttrValue" value="%{configAttrValue}" maxlength="23" cssClass="txtin"/>
              </s:else>
            </td>
          <td class="alignl"><s:property value="configAttrKey"/> &nbsp;</td>
        </tr>
        </s:iterator>
        <tr>
        <td class="height100" colspan="3"><s:submit cssClass="btnlist2" value="%{getText('save')}"/><s:reset value="%{getText('reset')}" cssClass="btnlist2"/></td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
</form>
<script type="text/javascript" src="${ctx}/js/cms.js"></script>
<script type="text/javascript">AR.Common.system_manage();</script>
<script type="text/javascript" defer="defer">
var security_Code_Run_Num_pass    =true;
var email_Port_pass               =true;
var comment_Interval_Time_pass    =true;
var comment_Max_Num_Perhour_pass  =true;
var comment_Max_Security_Perhour_pass=true;
var attachment_Advice_Size_pass   =true;

var passwd_pass=true;
  function chkform(){
	if(security_Code_Run_Num_pass&&email_Port_pass&&
			comment_Interval_Time_pass&&comment_Max_Num_Perhour_pass&&
			comment_Max_Security_Perhour_pass&&attachment_Advice_Size_pass&&passwd_pass){
			
		if(!confirm('确实要保存修改么？')){
		      return false;
		    }
	}else{
		alert("数据不合法");
		return false;
	}
   
  }
  function isPasswd(obj,id){
	  var configValue=$(obj).val();
	  var passwdReg=/^(\w|_){3,18}$/;
	  if(!passwdReg.test(configValue)){
		  $("#"+id).html("<br/>数据输入有误");
		  passwd_pass=false;
	  }else{
		  $("#"+id).html("");
		  passwd_pass=true;
	  }
  }
  
  function isNum(obj,id){
	  var configValue=$(obj).val();
	  var numReg=/^\d+$/;
	  if(!numReg.test(configValue)){
		  $("#"+id).html("数据输入有误");
		  if('security_Code_Run_Num_pass'==id+'_pass'){
			  security_Code_Run_Num_pass=false;
		  }else if('email_Port_pass'==id+'_pass'){
			  email_Port_pass=false;
		  }else if('comment_Interval_Time_pass'==id+'_pass'){
			  comment_Interval_Time_pass=false;
		  }else if('comment_Max_Num_Perhour_pass'==id+'_pass'){
			  comment_Max_Num_Perhour_pass=false;
		  }else if('comment_Max_Security_Perhour_pass'==id+'_pass'){
			  comment_Max_Security_Perhour_pass=false;
		  }else{
			  attachment_Advice_Size_pass=false;
		  }
	  }else{
		  $("#"+id).html(""); 
		  if('security_Code_Run_Num_pass'==id+'_pass'){
			  security_Code_Run_Num_pass=true;
		  }else if('email_Port_pass'==id+'_pass'){
			  email_Port_pass=true;
		  }else if('comment_Interval_Time_pass'==id+'_pass'){
			  comment_Interval_Time_pass=true;
		  }else if('comment_Max_Num_Perhour_pass'==id+'_pass'){
			  comment_Max_Num_Perhour_pass=true;
		  }else if('comment_Max_Security_Perhour_pass'==id+'_pass'){
			  comment_Max_Security_Perhour_pass=true;
		  }else{
			  attachment_Advice_Size_pass=true;
		  }
	  }
  }
</script>

</body>
</html>